<template>
  <div class="app-container">
    <el-table v-loading="loading" :data="structureList">
      <el-table-column
        label="油站名称"
        align="left"
        prop="stationName"
        v-if="false"
      />
      <el-table-column label="员工姓名" align="left" prop="person" />
      <el-table-column label="负责枪号" align="left" prop="gunNo" />
      <el-table-column label="销量(L)" align="left" prop="salesVolume" />
      <el-table-column label="销额" align="left" prop="salesAmount" />
      <el-table-column label="优惠" align="left" prop="discount" />
      <el-table-column label="优惠券" align="left" prop="coupon" />
      <el-table-column label="实收" align="left" prop="netReceipts" />
      <el-table-column label="销售笔数" align="left" prop="salesNum" />
      <el-table-column label="打印小票数" align="left" prop="printNum" />
      <el-table-column label="班次号" align="left" prop="classStructureNo" />
      <el-table-column
        label="班结时间"
        align="left"
        prop="classStructureDate"
        width="180"
      >
        <template slot-scope="scope">
          <span>{{
            parseTime(scope.row.classStructureDate, "{y}-{m}-{d}")
          }}</span>
        </template>
      </el-table-column>
      <el-table-column label="班结人" align="left" prop="classStructureMan" />
      <el-table-column
        label="操作"
        align="left"
        class-name="small-padding fixed-width"
      >
        <template slot-scope="scope">
          <el-button
            size="mini"
            type="text"
            icon="el-icon-edit"
            @click="handleUpdate(scope.row)"
            v-hasPermi="['station:structure:edit']"
            >修改</el-button
          >
          <el-button
            size="mini"
            type="text"
            icon="el-icon-delete"
            @click="handleDelete(scope.row)"
            v-hasPermi="['station:structure:remove']"
            >删除</el-button
          >
        </template>
      </el-table-column>
    </el-table>
  </div>
</template>

<script>
import {
  listStructure,
  getStructure,
  delStructure,
  addStructure,
  updateStructure,
  exportStructure,
} from "@/api/station/structure";

export default {
  name: "Structure",
  data() {
    return {
      // 遮罩层
      loading: true,
      // 选中数组
      ids: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      // 班结管理表格数据
      structureList: [],
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        stationId: null,
        stationName: null,
        person: null,
        gunNo: null,
        salesVolume: null,
        salesAmount: null,
        discount: null,
        coupon: null,
        netReceipts: null,
        salesNum: null,
        printNum: null,
        classStructureNo: null,
        classStructureDate: null,
        classStructureMan: null,
      },
      // 表单参数
      form: {},
      // 表单校验
      rules: {},
    };
  },
  created() {
    this.getList();
  },
  methods: {
    /** 查询班结管理列表 */
    getList() {
      this.loading = true;
      listStructure(this.queryParams).then((response) => {
        this.structureList = response.rows;
        this.total = response.total;
        this.loading = false;
      });
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
  },
};
</script>
